package cn.edu.sgu.www.mhxysy.dto.role;

import cn.edu.sgu.www.mhxysy.consts.CustomMessages;
import cn.edu.sgu.www.mhxysy.consts.IdentifierPrefixes;
import cn.edu.sgu.www.mhxysy.consts.RegExps;
import cn.edu.sgu.www.mhxysy.dto.DataTransferObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.time.LocalDateTime;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Data
@ApiModel
public class RoleAccountDTO implements DataTransferObject {

    /**
     * 角色ID
     */
    @Pattern(regexp = RegExps.ROLE_ID, message = "角色ID" + CustomMessages.ILLEGAL)
    @NotBlank(message = CustomMessages.ROLE_ID_NOT_NULL)
    @ApiModelProperty(value = "角色ID", required = true)
    private String id;

    /**
     * 角色名字
     */
    @Size(max = 6, message = "角色名字" + CustomMessages.TOO_LONG)
    @NotBlank(message = "角色名字" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "角色名字", required = true)
    private String name;

    /**
     * 角色等级
     */
    @Range(min = 1, max = 115, message = "角色等级" + CustomMessages.ILLEGAL)
    @NotNull(message = "角色等级" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "角色等级", required = true)
    private Integer grade;

    /**
     * 人物评分
     */
    @Positive(message = "人物评分" + CustomMessages.ILLEGAL)
    @NotNull(message = "人物评分" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "人物评分", required = true)
    private Integer score;

    /**
     * 金币数量
     */
    @NotNull(message = "金币数量" + CustomMessages.NOT_NULL)
    @ApiModelProperty(value = "金币数量", required = true)
    private Integer jinbi;

    /**
     * 帮派ID
     */
    @ApiModelProperty(value = "帮派ID")
    private String gangId;

    /**
     * 账号ID
     */
    @Pattern(regexp = IdentifierPrefixes.PREFIX_ACCOUNT + RegExps.UU_ID_SUFFIX, message = "坐骑ID" + CustomMessages.ILLEGAL)
    @NotBlank(message = "账号" + CustomMessages.ID_NOT_NULL)
    @ApiModelProperty(value = "账号ID", required = true)
    private String accountId;

    /**
     * 门派ID
     */
    @Positive(message = "门派ID" + CustomMessages.ILLEGAL)
    @NotNull(message = CustomMessages.SCHOOL_ID_NOT_NULL)
    @ApiModelProperty(value = "门派ID", required = true)
    private Integer schoolId;

    /**
     * 服务器ID
     */
    @Positive(message = "服务器ID" + CustomMessages.ILLEGAL)
    @NotNull(message = "服务器" + CustomMessages.ID_NOT_NULL)
    @ApiModelProperty(value = "服务器ID", required = true)
    private Integer serverId;

    /**
     * 角色造型ID
     */
    @Positive(message = "角色造型ID" + CustomMessages.ILLEGAL)
    @NotNull(message = "角色造型" + CustomMessages.ID_NOT_NULL)
    @ApiModelProperty(value = "角色造型ID", required = true)
    private Integer categoryId;

    /**
     * 账号创建时间
     */
    @Past(message = "账号创建时间" + CustomMessages.ILLEGAL)
    @NotNull(message = "账号创建时间" + CustomMessages.NOT_NULL)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "账号创建时间", required = true)
    private LocalDateTime birthday;
}